package com.deu.tsf.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.baomidou.mybatisplus.plugins.Page;
import com.deu.tsf.common.result.JsonResult;
import com.deu.tsf.entity.VehicleLoadInfo;
import com.deu.tsf.service.IVehicleLoadInfoService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
* @Description: 车辆载重数据控制层
* @author Y.Jin
* @date 2016年12月20日 上午10:01:05
 */
@Api(tags="车辆载重数据控制层")
@Controller
@RequestMapping(value="vehicleloadinfo")
public class VehicleLoadInfoController {
	
	@Autowired
	private IVehicleLoadInfoService vehicleLoadInfoService; 
	
	/**
	 * 添加载重数据
	 * @param vehicleLoadInfo
	 * @return
	 */
	@ApiOperation(value="添加载重数据")
	@RequestMapping(value="add",method=RequestMethod.POST)
	public JsonResult add(VehicleLoadInfo vehicleLoadInfo){
		JsonResult json = new JsonResult();
		vehicleLoadInfoService.insert(vehicleLoadInfo);
		return json;
	} 
	
	/**
	 * 删除车载数据信息
	 * @param id
	 * @return
	 */
	@ApiOperation(value="删除车载数据信息")
	@RequestMapping(value="{id}/del",method=RequestMethod.GET)
	public JsonResult del(@PathVariable Integer id){
		JsonResult json = new JsonResult();
		vehicleLoadInfoService.deleteById(id);
		return json;
	}
	
	/**
	 * 分页获取数据
	 * @param page
	 * @return
	 */
	@ApiOperation(value="分页获取数据")
	@RequestMapping(value="list",method=RequestMethod.GET)
	public JsonResult list(Page<VehicleLoadInfo> page){
		JsonResult json = new JsonResult();
		vehicleLoadInfoService.selectPage(page, null);
		return json;
	}
}
